package com.xbongbong.saas.domain.entity;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.toolbox.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author long.rao
 * @version v1.0
 * @date 2019/2/23 14:11
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class OpportunityProductEntity extends BusinessUnitProductEntity implements Serializable {
    private static final long serialVersionUID = -5844480958830495070L;

    //主键
    private Long id;
    //公司ID
    private String corpid;
    //表单id
    private Long formId;
    //销售机会ID
    private Long opportunityId;
    //父产品ID
    private Long parentId;
    //产品ID
    private Long productId;
    //产品名称
    private String productName;
    //产品数量
    private Double productNum;
    //产品编号
    private String productNo;
    //销售价格:
    private Double price;
    //单位
    private String productUnit;
    //折扣
    private Double discount;
    //规格
    private String specification;
    // 排序
    private Integer sort;
    //创建时间
    private Long addTime;
    //更新时间
    private Long updateTime;
    //删除标志
    private Integer del;
    // 产品成本（记录产品历史成本）
    private Double cost;
    //自定义字段
    private JSONObject data;

    private String memo;

    // 产品历史单价
    private Double historicalPrice;

    private JSONArray productPriceArr;

//
//    //产品封面
//    private String thumbnail;
//    //产品规格
//    private String spec;
//    //产品分类
//    private Long categoryId;
//    //产品单位
//    private String unit;
//    //产品单价
//    private Double unitPrice;
//    //产品名称
//    private String name;
//    //产品编号
//    private String productNo;
//    //产品成本
//    private Double unitCost;
//
//    private String priceStr = "";
//    private String productNumStr = "";
//
//    //型号
//    private JSONArray specificationArray = new JSONArray();
//    //格式化后的规格展示
//    private String formatedSpecifiation = "";


    public OpportunityProductEntity(){
        long now = DateUtil.getInt();
        this.productName = "";
        this.productNum = 0d;
        this.price = -1D;
        this.discount = 100d;
        this.specification = "";
//        this.thumbnail = ConfigConstant.DEFAULT_PIC;
//        this.spec = "";
//        this.categoryId = 0L;
//        this.unit = "";
//        this.unitPrice = 0d;
//        this.name = "";
        this.productNo = "";
        this.addTime = now;
        this.updateTime = now;
        this.del = 0;
        this.cost = 0D;
    }
}
